#include "BaseSprite.h"

//=====CONSTRUCTORS
BaseSprite::BaseSprite(Pair Pos, int Tex,D3DCOLOR Color,char* nText)
	:mvPosition(0,0,0)
{
	meiObjID = Tex;

	mvPosition.x = Pos.X;
	mvPosition.y = Pos.Y;

	Text = nText;

	mvColor = Color;


	D3DXMATRIX				mvMatTrans;	
	D3DXMATRIX				mvRotation;

	D3DXMatrixIdentity		(&mvRotation);
	D3DXMatrixIdentity		(&mvWorldTrans);

	D3DXMatrixTranslation	(&mvMatTrans,mvPosition.x,mvPosition.y, 0); 
	D3DXMatrixMultiply		(&mvWorldTrans,&mvRotation, &mvMatTrans);	
};
//=====INITIALIZE
void BaseSprite::InitRect(Pair Dimensions)
{
	float X = Dimensions.X * 0.5f;
	float Y = Dimensions.Y * 0.5f;
	DrawBox.right	= (LONG)(mvPosition.x + X);
	DrawBox.left	= (LONG)(mvPosition.x - X);
	DrawBox.top		= (LONG)(mvPosition.y - Y);
	DrawBox.bottom	= (LONG)(mvPosition.y + Y);
}



//=====ACCESSORS
RECT BaseSprite::GetRect()
{
	return DrawBox;
};
bool BaseSprite::CheckBounds(POINT Mouse)
{
	long X(Mouse.x),Y(Mouse.y);

	if (X > DrawBox.left && X < DrawBox.right)
		if(Y < DrawBox.bottom && Y > DrawBox.top)
			return true;
	return false;
};
int  BaseSprite::getObjID()				{return meiObjID	;};
int  BaseSprite::GetShowState()			{return ShowState	;};
int  BaseSprite::GetSwitchState()		{return SwitchState ;};
char* BaseSprite::GetText()				{return Text		;};
D3DCOLOR BaseSprite::getColor()			{return mvColor		;};
D3DXMATRIX BaseSprite::getTransform()	{return mvWorldTrans;};